<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  const p = new Promise(function(resolve, reject) {
    setTimeout(function() {
      // let data = 'data';
      // resolve(data);

      let err = 'err';
      reject(err);
    }, 1000)
  });

  p.then(function(value) {
    console.log(value);
  }, function(reason) {
    console.log(reason);
  })
</script>
</body>
</html>